<template>
  <div>
    <h1>登录页</h1>
    <div>用户名：<input type="text" v-model="username" /></div>
    <button @click="login">跳转到登录页</button>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";

const username = ref("");
const $router = useRouter();
const login = () => {
  sessionStorage.setItem("username", username.value);
  $router.push("/layout");
};
</script>

<style scoped></style>
